
<!--分页查询共用的页面-->
<%@ include file="/common/paginateUtil.jsp"%>

<%@ include file="/common/dateUtil.jsp"%>
  <%@ page language="java" pageEncoding="UTF-8"%>
	<style>
        select {
			width:80px;
	    }
		input [type="text"] 
		{
			width:100px;
		}

	</style>
</head>

<script type="text/javascript" charset="utf-8">
			
	function getCardStateColumn(value, rowData, rowIndex) {
		if (value == 1)
			return "插卡";
		else if (value == 2)
			return "拔卡";
		return "未知:" + value;
	}

	function getReadResultColumn(value, rowData, rowIndex) {
		if (value == 0)
			return "成功";
		return "失败";
	}

	function formatImgFileName1(value,rowData,rowIndex){
		// console.log("imgFileName = " + value);
		// console.log(rowData);
		var str =  getFormatterStr(value,0);
		return str;
	}

	function formatImgFileName2(value,rowData,rowIndex){
		// console.log("imgFileName = " + value);
		// console.log(rowData);
		var strTemp = rowData.fileNames;
		var str =  getFormatterStr(strTemp,1);
		return str;
	}

	function formatImgFileName3(value,rowData,rowIndex){
		// console.log("imgFileName = " + value);
		// console.log(rowData);
		var strTemp = rowData.fileNames;
		var str =  getFormatterStr(strTemp,2);
		return str;
	}

	//获取格式化字符串
	function getFormatterStr(value,index){
		var returnStr = "";
		if(typeof(value) != "undefined"){
			var strTemp = '' + value;
			var list = strTemp.split(",");
			// console.log(list);
			// console.log("字符串总长度为：" + list.length + "现在开始返回第 " + (index +1) + "个，值为 : " + list[index]);
			if(list.length > index){
				var fileStr = list[index];
				returnStr = getFileHtml(fileStr);
			}
		}
		return returnStr;
	}

	//根据图片名称，返回html超链接代码
	function getFileHtml(str){
		var fileName = "<%=ApplicationPath%>/vehiclePicture/" + str;
		html = "<a href=\"javascript:InfoWindow.viewAdasAlarmAttachment('" + fileName + "');\">" + " 查看</a>";
		return html;
	}

	$(document).ready(function () {

	 	//创建下拉部门树
		Utility.createDepTree("depId1");

		var now = Utility.today();
		$("#startDate").val(now + " 00:00:00");
		$("#endDate").val(now + " 23:59:59");
		//   var now = Utility.today();


		$("#btnQuery").click(function () {
			var treeSelected = $("#depId1").combotree("tree").tree("getSelected");
			if(treeSelected!= null && treeSelected.id > 0){
				$("#depId").val(treeSelected.id);
			}else{
				$("#depId").val("");
			}


			$(document).ready(function() {
				
				//创建下拉部门树
				Utility.createDepTree("depId");
					
			 	var now = Utility.today(1);
				  $("#endDate").val((now + " 23:59:59"));
				  var now = Utility.today();
				  $("#startDate").val((now + " 00:00:00"));


			Utility.loadGridWithParams();
		});

		$("#cardState").change(function () {
			var txt = $("#cardState").find("option:selected").text();
			$("#cardStateName").val(txt);
		});


	});


	</script>
<body>
		<div id="toolbar">		
			
			<form id="queryForm" action="<%=ApplicationPath%>/report/paginate.action">
			   <input type="hidden" name="queryId" value="report.selectDriverCards" />		    	    
			   <input type="hidden" name="fileName" value="司机插卡拔卡记录" />	  	
			   <input type="hidden" id="cardStateName"  name="cardStateName" value="所有" />	
			   <input type="hidden" id="depId"  name="depId"  value="所有"/>     
			  <table width="100%"  class="TableBlock">
			   			   <tr>
						    <td> 车牌号码 </td>
					<td>			   
					<input type="text" id="plateNo" name="plateNo" > 
					</td>
				   <td> 车组名称 </td>
					<td>			  
				<select id="depId1" name="depId1" style="width:200px;"></select>
				
               </td>
			   
				<td>操作类型</td>
			   <td> <select id="cardState" name="cardState" width="10">
			      <option value="">请选择</option>
			      <option value="1">插卡</option>
				  <option value="2">拔卡</option>
			   </select>
			   </td>
            </tr>
				<tr>						
						<td align="right">开始时间
							:</td>
						<td>
      <input type="text" name="startDate"  id="startDate"   class="datetimepicker" />
						</td>
						<td>结束时间:</td>
						<td align="left">
      <input type="text" name="endDate"   id="endDate"    class="datetimepicker" />
						</td>
				
        <td colspan="4" align="left">
	      <a id="btnQuery" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" >查询</a>&nbsp;
		   <a id="btnReset" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" >重置</a>&nbsp;
		   <a id="btnExport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" onclick="Utility.excelExport('<%=ApplicationPath%>/export.action');">导出</a><!--调用utility.js-->
		</td>
    </tr>
		</table>
		</form>	 
		
  </div>
				<table id="queryGrid" class="easyui-datagrid" title="" style="width:100%;"
						data-options="pagination:true,pageSize:15,singleSelect:true,rownumbers:true,striped:true,fitColumns: true,align:'center',
						pageList: [15, 20, 50, 100, 150, 200],fit:true,toolbar:'#toolbar',
						url:'<%=ApplicationPath%>/report/paginate.action',method:'get'">
					<thead>
						<tr>
								<th data-options="field:'plateNo'"  width="80">车牌号</th>
								<th data-options="field:'depName'"  width="80">车组</th>
								<th data-options="field:'cardState',formatter:getCardStateColumn"  width="60">IC卡状态</th>
								<th data-options="field:'readResult',formatter:getReadResultColumn"  width="60">读卡结果</th>
								<th data-options="field:'operTime'"  width="120">操作时间</th>
								<th data-options="field:'fileNames',formatter:formatImgFileName1"  width="50">图片1</th>
								<th data-options="field:'id',formatter:formatImgFileName2"  width="50">图片2</th>
								<th data-options="field:'vehicleId',formatter:formatImgFileName3"  width="50">图片3</th>
								<th data-options="field:'driverName'"  width="80">驾驶员</th>
								<th data-options="field:'certificationCode'"  width="100">驾驶证</th>
								<th data-options="field:'agencyName'"  width="100">发证机构</th>
								<th data-options="field:'validateDate'"  width="70">证件有效期</th>
								<th data-options="field:'createDate'"  width="120">上传时间</th>
						</tr>
					</thead>
					<tbody>
						
					</tbody>					
				</table>

</body>

